import java.util.*;

//宝石与石头
public class numJewelsInStones {
    public int numJewelsInStones(String jewels, String stones) {
        Set<Character> set=new HashSet<>();
        for (char x:jewels.toCharArray()){
            set.add(x);
        }
        int count=0;
        for (char x:stones.toCharArray()){
           if (set.contains(x)){
               count++;
           }
        }
        return count;
    }
//前k个高频单词
public List<String> topKFrequent(String[] words, int k) {
        Map<String,Integer> map=new HashMap<>();
        for (String word:words){
            if (map.get(word)==null){
                map.put(word,1);
            }else {
                int val=map.get(word);
                val++;
                map.put(word,val);
            }
        }
    //建立大根堆
        PriorityQueue<Map.Entry<String,Integer>> priorityQueue=new PriorityQueue<>(new Comparator<Map.Entry<String, Integer>>() {
            @Override
            public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
               if(o1.getValue().compareTo(o2.getValue())==0){
                   return o2.getKey().compareTo(o1.getKey());
               }else {
                   return o1.getValue().compareTo(o2.getValue());
               }
            }
        });
        for (Map.Entry<String,Integer> entry:map.entrySet()){
            if (priorityQueue.size()<k){
                priorityQueue.offer(entry);
            }else {
                Map.Entry<String,Integer> top=priorityQueue.peek();
                if(top.getValue()<entry.getValue()){
                    priorityQueue.poll();
                    priorityQueue.add(entry);
                }else {
                    if(top.getValue()==entry.getValue()){
                        if (top.getKey().compareTo(entry.getKey())>0){
                            priorityQueue.poll();
                            priorityQueue.add(entry);
                        }
                    }
                }
            }
        }
           List<String> list=new LinkedList<>();
        while (k!=0){
            list.add(priorityQueue.poll().getKey());
            k--;
        }
        return list;
}
//坏键盘打字
public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    // 注意 hasNext 和 hasNextLine 的区别
    while (in.hasNextLine()) { // 注意 while 处理多个 case
        String a = in.nextLine();
        String b = in.nextLine();
        Set<Character> set=new HashSet<>();
        Set<Character> tmp=new HashSet<>();
        for (char x:b.toUpperCase().toCharArray()){
            set.add(x);
        }
        for (char y:a.toUpperCase().toCharArray()){
            if(!set.contains(y)&&!tmp.contains(y)){
                System.out.print(y);
                tmp.add(y);
            }
        }
    }

}
}
